(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
prime(0) → false
prime(s(0)) → false
prime(s(s(x))) → prime1(s(s(x)), s(x))
prime1(x, 0) → false
prime1(x, s(0)) → true
prime1(x, s(s(y))) → and(not(divp(s(s(y)), x)), prime1(x, s(y)))
divp(x, y) → =(rem(x, y), 0)
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
prime1(x, s(s(y))) →+ and(not(divp(s(s(y)), x)), prime1(x, s(y)))
gives rise to a decreasing loop by considering the right hand sides subterm at position [1].
The pumping substitution is [y / s(y)].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
prime(0') → false
prime(s(0')) → false
prime(s(s(x))) → prime1(s(s(x)), s(x))
prime1(x, 0') → false
prime1(x, s(0')) → true
prime1(x, s(s(y))) → and(not(divp(s(s(y)), x)), prime1(x, s(y)))
divp(x, y) → ='(rem(x, y), 0')
S is empty.
Rewrite Strategy: FULL
(5) SlicingProof (LOWER BOUND(ID) transformation)
Sliced the following arguments:
prime1/0
divp/0
divp/1
='/0
='/1
rem/0
rem/1
(6) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
prime(0') → false
prime(s(0')) → false
prime(s(s(x))) → prime1(s(x))
prime1(0') → false
prime1(s(0')) → true
prime1(s(s(y))) → and(not(divp), prime1(s(y)))
divp → ='
S is empty.
Rewrite Strategy: FULL
(7) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(8) Obligation:
TRS:
Rules:
prime(0') → false
prime(s(0')) → false
prime(s(s(x))) → prime1(s(x))
prime1(0') → false
prime1(s(0')) → true
prime1(s(s(y))) → and(not(divp), prime1(s(y)))
divp → ='
Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
(9) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
prime1
(10) Obligation:
TRS:
Rules:
prime(
0') →
falseprime(
s(
0')) →
falseprime(
s(
s(
x))) →
prime1(
s(
x))
prime1(
0') →
falseprime1(
s(
0')) →
trueprime1(
s(
s(
y))) →
and(
not(
divp),
prime1(
s(
y)))
divp →
='Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
Generator Equations:
gen_false:true:and5_0(0) ⇔ false
gen_false:true:and5_0(+(x, 1)) ⇔ and(not(='), gen_false:true:and5_0(x))
gen_0':s6_0(0) ⇔ 0'
gen_0':s6_0(+(x, 1)) ⇔ s(gen_0':s6_0(x))
The following defined symbols remain to be analysed:
prime1
(11) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
prime1(
gen_0':s6_0(
+(
1,
n8_0))) →
*7_0, rt ∈ Ω(n8
0)
Induction Base:
prime1(gen_0':s6_0(+(1, 0)))
Induction Step:
prime1(gen_0':s6_0(+(1, +(n8_0, 1)))) →RΩ(1)
and(not(divp), prime1(s(gen_0':s6_0(n8_0)))) →RΩ(1)
and(not(='), prime1(s(gen_0':s6_0(n8_0)))) →IH
and(not(='), *7_0)
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(12) Complex Obligation (BEST)
(13) Obligation:
TRS:
Rules:
prime(
0') →
falseprime(
s(
0')) →
falseprime(
s(
s(
x))) →
prime1(
s(
x))
prime1(
0') →
falseprime1(
s(
0')) →
trueprime1(
s(
s(
y))) →
and(
not(
divp),
prime1(
s(
y)))
divp →
='Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
Lemmas:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
Generator Equations:
gen_false:true:and5_0(0) ⇔ false
gen_false:true:and5_0(+(x, 1)) ⇔ and(not(='), gen_false:true:and5_0(x))
gen_0':s6_0(0) ⇔ 0'
gen_0':s6_0(+(x, 1)) ⇔ s(gen_0':s6_0(x))
No more defined symbols left to analyse.
(14) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
(15) BOUNDS(n^1, INF)
(16) Obligation:
TRS:
Rules:
prime(
0') →
falseprime(
s(
0')) →
falseprime(
s(
s(
x))) →
prime1(
s(
x))
prime1(
0') →
falseprime1(
s(
0')) →
trueprime1(
s(
s(
y))) →
and(
not(
divp),
prime1(
s(
y)))
divp →
='Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
Lemmas:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
Generator Equations:
gen_false:true:and5_0(0) ⇔ false
gen_false:true:and5_0(+(x, 1)) ⇔ and(not(='), gen_false:true:and5_0(x))
gen_0':s6_0(0) ⇔ 0'
gen_0':s6_0(+(x, 1)) ⇔ s(gen_0':s6_0(x))
No more defined symbols left to analyse.
(17) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
(18) BOUNDS(n^1, INF)